// widgets/HomeWidget/HomeScrollWidget/HomeScrollWidget.js
//获取应用实例
const app = getApp()
const assetsAddress = app.globalData.global.assetsIp + '/' + app.globalData.global.assetsName;
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    isShowBackTop: {
      type: Boolean,
      value: false,
    },
    isShowZhb: {
      type: Boolean,
      value: true,
    },
    isShowShare: {
      type: Boolean,
      value: true,
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    assetsAddress: assetsAddress,
  },

  /**
   * 组件的方法列表
   */
  methods: {
    // 返回顶部
    backTop(){
      wx.pageScrollTo({
        duration: 0,
        scrollTop: 0,
      })
    },
    // 分享
    toShare(){
      console.log('打开分享')
      wx.showShareMenu({
        withShareTicket: true,
        menus: ['shareAppMessage', 'shareTimeline']
      })
    },
    // 打开视频号
    showSPH(){
      wx.openChannelsUserProfile({
        finderUserName: 'sphrgYcHMTQ4rdW',
        success: (res)=>{
          console.log(res,'res')
        },
        fail: (err) => {
          console.log(err,'err')
        },
      })
    },
  }
})
